function nodeList(name) {
    this.name = name
    this.next = null
}
function reserveList(head, left, right) {
    let dummy_node = new nodeList(0)
    dummy_node.next = head;

    let pre = dummy_node;
    for (let i = 0; i < left - 1; i++) {
        pre = pre.next
    }

    let cur = pre.next;
    for (let i = 0; i < right - left; i++) {
        let next = cur.next;
        cur.next = next.next;
        next.next = cur;
        pre.next = next;
    }
    return dummy_node.next;
}